﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Safal.IncidentTracker.Domain.Entities.Incident>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit <%: Model.Title %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2><%:(Model.Id == 0) ? "Create" : "Edit" %> <%: Model.Title %></h2>
    
    <% Html.EnableClientValidation(); %>

    <% using (Html.BeginForm("Edit", "Incidents", FormMethod.Post)) { %>
        <%: Html.ValidationSummary() %>
           
        <%: Html.HiddenFor(x => x.Id) %> 
        
        <%: Html.HiddenFor(x => x.DateOfIncident) %> 

        <p>
            <%: Html.LabelFor(x => x.Title) %> <br />
            <%: Html.EditorFor(x => x.Title) %>
            <%: Html.ValidationMessageFor(x => x.Title) %>
        </p>
        <p>
            <%: Html.LabelFor(x => x.Casualty) %> <br />
            <%: Html.EditorFor(x => x.Casualty)%>
            <%: Html.ValidationMessageFor(x => x.Casualty)%>
        </p>
        <p>
            <%: Html.LabelFor(x => x.Description) %> <br />
            <%: Html.TextAreaFor(x => x.Description)%>
            <%: Html.ValidationMessageFor(x => x.Description)%>
        </p>
        <p>
            <%: Html.LabelFor(x => x.InjuryLocation) %> <br />
            <%: Html.EditorFor(x => x.InjuryLocation)%>
            <%: Html.ValidationMessageFor(x => x.InjuryLocation)%>
        </p>
        <p>
            <%: Html.LabelFor(x => x.InjuryType) %> <br />
            <%: Html.EditorFor(x => x.InjuryType)%>
            <%: Html.ValidationMessageFor(x => x.InjuryType)%>
        </p>

        <input type="submit" value="Save" />        
    <% } %>
    <% using (Html.BeginForm("Delete", "Incidents", FormMethod.Post)) {%>
        <%: Html.HiddenFor(x => x.Id) %> 
        <input type="submit" value="Delete" />
    <% } %>
    <p>
        <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |
        <%: Html.ActionLink("Back to List", "List") %>
        
    </p>

</asp:Content>

